# coding:utf-8
from app.libs.redprint import Redprint
from flask import request
from app.libs.helper import is_isbn

api = Redprint('book')


@api.route('/search')
def search_book():
    '''
        keyword 图书、作者、isbn 纯数字
        page
        :return:
    '''
    keyword = request.args.get('keyword')
    print(keyword)
    isbn_or_key = 'key'
    if is_isbn(keyword):
        isbn_or_key = 'isbn'

    return 'get book'


@api.route('/detail')
def detail():
    '''
        keyword 图书、作者、isbn 纯数字
        page
        :return:
    '''
    book_id = request.args.get('id')
    print(book_id)
    isbn_or_key = 'key'
    if is_isbn(book_id):
        isbn_or_key = 'isbn'

    return 'get book'